﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace RGPWEB.admin.ModifyPrice
{
    public partial class ModifyPrice : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                TextBox1.Attributes.Add("onkeydown", "if(event.keyCode==13)  {document.all." + ButtonFind.ClientID + ".focus();document.all." + this.ButtonFind.ClientID + ".click();}");

            }
            
            
            
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Msg", "window.parent.changewin();", true);

            string[] sate = { "是", "否" };
            if (!SessionBox.CheckUserSession())
            {
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                UserHandle.InitModule("Demo_Control");//初始化模块权限

                //浏览权限
                if (UserHandle.ValidationHandle(RGP_Tag.Browse))
                    ; // Label1.Text = sate[0];
                else
                    ; // Label1.Text = sate[1];

                //新增权限
                if (UserHandle.ValidationHandle(RGP_Tag.Add))
                    ; // Label2.Text = sate[0];
                else
                    ; // Label2.Text = sate[1];

                //编辑权限
                if (UserHandle.ValidationHandle(RGP_Tag.Edit))
                    ; // Label3.Text = sate[0];
                else
                    ; // Label3.Text = sate[1];

                //删除权限
                if (UserHandle.ValidationHandle(RGP_Tag.Delete))
                    ; // Label4.Text = sate[0];
                else
                    ; // Label4.Text = sate[1];

                //搜索权限
                if (UserHandle.ValidationHandle(RGP_Tag.Search))
                    ; //Label5.Text = sate[0];
                else
                    ; // Label5.Text = sate[1];

                //审核权限
                if (UserHandle.ValidationHandle(RGP_Tag.Verify))
                    ; // Label6.Text = sate[0];
                else
                    ; //Label6.Text = sate[1];

                //移动权限
                if (UserHandle.ValidationHandle(RGP_Tag.Move))
                    ; // Label7.Text = sate[0];
                else
                    ; // Label7.Text = sate[1];

                //打印权限
                if (UserHandle.ValidationHandle(RGP_Tag.Print))
                    ; // Label8.Text = sate[0];
                else
                    ; // Label8.Text = sate[1];

                //下载权限
                if (UserHandle.ValidationHandle(RGP_Tag.Download))
                    ; //Label9.Text = sate[0];
                else
                    ; // Label9.Text = sate[1];

                //备份权限
                if (UserHandle.ValidationHandle(RGP_Tag.Backup))
                    ; //Label10.Text = sate[0];
                else
                    ; //Label10.Text = sate[1];
            }





        }

        protected void ButtonFind_Click(object sender, EventArgs e)
        {
            GridView1.DataSourceID = ObjectDataSource2.ID;
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
            {
                //当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色
                e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#ffffcd',this.style.fontWeight='';");
                //当鼠标离开的时候 将背景颜色还原的以前的颜色
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
                
           //     if(DataBinder.Eval(e.Row.DataItem, "fplanprice")!=DBNull.Value)
              //  Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fplanprice")).ToString("###,###,##0.00");
           //         Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fplanprice")).ToString("2");
            }

            
        }

        //protected void ObjectDataSource2_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        //{
        //    e.InputParameters["_fnumber"] = TextBox1.Text;
        //}
    }
}
